package WaiBao;

import java.util.Arrays;

public class SunYanQian {
    public static void main(String[] args) {
        String[] name= {"楚云飞(班长)", "李云龙(副班长)", "小李(学习委员)", "孔二苗(文艺委员)", "孔祥翔", "任飞翔", "任上兵", "任下海", "张国立", "杨幂", "杨迪", "郑凯",
                "王道", "王海", "王海文", "王大强", "于胜军", "张德发", "张好好", "理算", "张村头", "孙尚香", "孙群", "孙权", "刘备", "关羽", "张飞", "张苞",
                "林晨阳", "孙妍倩(学生)"};//考生本人:孙妍倩(学生)
        int[] age = {21, 22,18,19,22, 21, 21, 20, 18, 22,19, 21, 20, 19, 18,20, 18, 19, 20, 19, 19,21, 20, 21, 20, 20, 19,20,20, 20};//考生年龄：20岁

        double[] shiye1 = {74, 61, 84, 91, 61, 81, 84, 88, 77, 67, 83, 77, 85, 77, 75, 68, 69, 99, 96, 88, 82, 91, 95, 88, 75, 74, 84, 76, 74, 96};
        double[] shiye2 = {85, 84, 84, 74, 74, 83, 84, 84, 84, 84, 68, 81, 74, 76, 61, 65, 86, 74, 86, 68, 82, 75, 90, 86, 85, 84, 74, 85, 94, 97};
        double[] shiye3 = {76, 66, 91, 84, 74, 69, 88, 89, 80, 68, 83, 87, 85, 75, 65, 61, 89, 69, 96, 93, 95, 81, 85, 95, 79, 85, 79, 78, 69, 96};




        double ben1;//代表每个学生的总分
        double ben2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            ben1 =shiye1[i] +shiye2[i] +shiye3[i];
//            ben2 = (ben1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + ben1);
//            System.out.println(name[i] + "的平均分为:" +ben2);
//        }

//
//        double nianji1 = 0,nianji2 = 0;
//        double[] dongshi = new double[30];
//        for (int i = 0; i < 30; i++) {
//            nianji1 = shiye1[i] + shiye2[i] +shiye3[i];
//            nianji2= (nianji1 * 1.0) / 3;
//            dongshi[i] = nianji2;
//        }
//
//        for (int i = 0; i < dongshi.length - 1; i++) {
//            for (int j = 0; j <dongshi.length - i - 1; j++) {
//                if (dongshi[j] < dongshi[j + 1]) {
//                    double tep =dongshi[j];
//                    dongshi[j] =dongshi[j + 1];
//                    dongshi[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(dongshi[i]);
//        }



        double touitng1 = 0,touitng2 = 0, touitng3 = 0;//计算每门课的平均分
        double manman1 = 0,manman2 = 0, manman3 = 0;//计算每门课标准差
        double liuye1 = 0,liuye2 = 0,liuye3 = 0;//计算每门课中位数
        double sum2 = 0;
//        for (int i = 0; i <shiye1.length; i++) {
//            sum2+=shiye1[i];
//        }
//        touitng1 = (sum2*1.0)/30;
//        System.out.println("生物化学的班级平均分为:"+touitng1);
//        double Sum = 0;
//        for (int i = 0; i <shiye2.length; i++) {
//            Sum+=shiye2[i];
//        }
//        touitng2 = (Sum*1.0)/30;
//        System.out.println("微生物学的班级平均分为:"+touitng2);
//        double sum = 0;
//        for (int i = 0; i <shiye3.length; i++) {
//            sum+=shiye3[i];
//        }
//        touitng3 = (sum*1.0)/30;
//        System.out.println("人体组织解剖学的班级平均分为:"+touitng3);
//
//
//
//        double c1 = 0,c2 = 0,c3 = 0;
//        for (int i = 0; i <shiye1.length; i++) {
//            c1+= (shiye1[i] -touitng1)*(shiye1[i] - touitng1);
//        }
//        manman1 = Math.sqrt(c1*1.0/30);
//        System.out.println("生物化学的班级标准差为:"+manman1);
//
//        for (int i = 0; i < shiye2.length; i++) {
//            c2+= (shiye2[i] -touitng2)*(shiye2[i] - touitng2);
//        }
//        manman2 = Math.sqrt(c2*1.0/30);
//        System.out.println("微生物学的班级标准差为:"+manman2);
//
//        for (int i = 0; i <shiye3.length; i++) {
//            c3+= (shiye3[i] -touitng3)*(shiye3[i] - touitng3);
//        }
//        manman3 = Math.sqrt(c3*1.0/30);
//        System.out.println("人体组织解剖学的班级标准差为:"+manman3);
//////////////
////////////
        Arrays.sort(shiye1);
        Arrays.sort(shiye2);
        Arrays.sort(shiye3);
        liuye1 =(shiye1[14]+shiye1[15])*1.0/2;
        liuye2 =(shiye2[14]+shiye2[15])*1.0/2;
        liuye3 =(shiye3[14]+shiye3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+ liuye1);
        System.out.println("微生物学的中位数为:"+liuye2);
        System.out.println("人体组织解剖学的中位数为:"+liuye3);





    }
}
